package top.hkyzf.study.leetcode.array;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2020-12-16 17:28
 */
public class 最富有客户的资产总量_1672 {

    @Test
    public void testMaxWealth() {
        int[][] accounts = new int[][]{{1,2,3},{3,2,1}};
        int result = maximumWealth(accounts);
        System.out.println(result);
    }

    /**
     * 1672. 最富有客户的资产总量
     * @param accounts
     * @return
     */
    private int maximumWealth(int[][] accounts) {
        int max = 0;
        for(int m=0; m<accounts.length; m++) {
            int hang = 0;
            for(int n=0; n<accounts[m].length; n++) {
                hang += accounts[m][n];
            }
            if(max < hang) {
                max = hang;
            }
        }
        return max;
    }

}
